"""
互动相关模型
"""
from datetime import datetime, date
from sqlalchemy import Column, Integer, String, Text, DateTime, SmallInteger, Date
from app.db.session import Base


class Message(Base):
    """留言表"""
    __tablename__ = "messages"
    
    id = Column(Integer, primary_key=True, index=True, comment="主键ID")
    name = Column(String(50), nullable=False, comment="姓名")
    phone = Column(String(20), comment="电话")
    email = Column(String(100), comment="邮箱")
    company = Column(String(100), comment="公司")
    subject = Column(String(100), comment="主题")
    content = Column(Text, nullable=False, comment="留言内容")
    ip_address = Column(String(50), comment="IP地址")
    status = Column(SmallInteger, default=0, index=True, comment="状态: 0未处理 1已处理")
    reply = Column(Text, comment="回复内容")
    replied_at = Column(DateTime, comment="回复时间")
    replied_by = Column(Integer, comment="回复人ID")
    created_at = Column(DateTime, default=datetime.now, index=True, comment="创建时间")


class Resume(Base):
    """简历表"""
    __tablename__ = "resumes"
    
    id = Column(Integer, primary_key=True, index=True, comment="主键ID")
    job_id = Column(Integer, nullable=False, index=True, comment="职位ID")
    name = Column(String(50), nullable=False, comment="姓名")
    phone = Column(String(20), nullable=False, comment="电话")
    email = Column(String(100), nullable=False, comment="邮箱")
    gender = Column(String(10), comment="性别")
    birth_date = Column(Date, comment="出生日期")
    education = Column(String(50), comment="学历")
    work_experience = Column(Integer, comment="工作年限")
    current_company = Column(String(100), comment="当前公司")
    expected_salary = Column(String(50), comment="期望薪资")
    resume_file = Column(String(255), comment="简历文件")
    self_introduction = Column(Text, comment="自我介绍")
    status = Column(SmallInteger, default=0, index=True, comment="状态: 0待处理 1已查看 2面试中 3已录用 4不合适")
    notes = Column(Text, comment="备注")
    ip_address = Column(String(50), comment="IP地址")
    created_at = Column(DateTime, default=datetime.now, index=True, comment="创建时间")
    updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment="更新时间")

